// src/api/auth.js
import axios from 'axios';
import { setToken, setUserInfo } from '../utlis/auth';

const login = async (data) => {
    try {
        const res = await axios.post('http://blogapi.shbwyz.com/login', data);
        setToken(res.data.token);
        setUserInfo(res.data);
        return res.data;
    } catch (error) {
        throw error.response.data;
    }
};
export default login;